class ContactRecord < ActiveRecord::Base

  attr_protected []
  
  belongs_to :customer
  belongs_to :recorded_by, :class_name => "User", :foreign_key => "recorded_by_id"
  
  validates :customer_id,
    :content,
    :contacted_on,
    :recorded_by_id,
    :presence => true
    
  default_scope lambda { where( :enterprise_id => Enterprise.current_id ) }
  
  before_validation do |record|
    record.recorded_by ||= User.current    
    record.contacted_on ||= Date.today
  end
end
